import { requestClient } from '#/api/request';

export namespace AiTrainingDatasetCategoriesApi {
  /** 数据集分类信息 */
  export interface TrainingDatasetCategories {
    id: number; // 分类或场景id
    code: string; // 分类或场景编码
    name?: string; // 分类或场景名称
    parentId: number; // 父级分类或场景ID
    description: string; // 分类或场景描述
    icon: string; // 图标
    color: string; // 颜色
    status?: number; // 状态
    sort: number; // 排序
    codePath: string; // 分类路径
    path: string; // id路径
    systemFlag: boolean; // 是否系统内置
    datasetCount: number; // 数据集个数
    children?: TrainingDatasetCategories[];
  }
}

/** 查询数据集分类列表 */
export function getTrainingDatasetCategoriesList(data: any) {
  return requestClient.post<
    AiTrainingDatasetCategoriesApi.TrainingDatasetCategories[]
  >('/ai/training-dataset-categories/list', data);
}

/** 查询数据集分类详情 */
export function getTrainingDatasetCategories(id: number) {
  return requestClient.get<AiTrainingDatasetCategoriesApi.TrainingDatasetCategories>(
    `/ai/training-dataset-categories/get?id=${id}`,
  );
}

/** 新增数据集分类 */
export function createTrainingDatasetCategories(
  data: AiTrainingDatasetCategoriesApi.TrainingDatasetCategories,
) {
  return requestClient.post('/ai/training-dataset-categories/create', data);
}

/** 修改数据集分类 */
export function updateTrainingDatasetCategories(
  data: AiTrainingDatasetCategoriesApi.TrainingDatasetCategories,
) {
  return requestClient.put('/ai/training-dataset-categories/update', data);
}

/** 删除数据集分类 */
export function deleteTrainingDatasetCategories(id: number) {
  return requestClient.delete(
    `/ai/training-dataset-categories/delete?id=${id}`,
  );
}

/** 导出数据集分类 */
export function exportTrainingDatasetCategories(params: any) {
  return requestClient.download(
    '/ai/training-dataset-categories/export-excel',
    { params },
  );
}
